package com.itheima.stringTest;

import java.util.Scanner;

public class strDome1 {
    public static void main(String[] args) {
//        需求：已知正确的账号和密码，模拟用户登录操作。三次机会，给出相应的提示！！
        String userName = "zhansan";
        String password = "123456";
        int count = 3;
        Scanner sc = new Scanner(System.in);

        while (true) {
            count--;
            System.out.println("请输入账号：");
            String name = sc.next();
            System.out.println("请输入密码：");
            String psw = sc.next();
            if (userName.equals(name) && password.equals(psw)) {
                System.out.println("验证成功！欢迎登录！");
                break;
            } else {
                if (count == 0) {
                    System.out.println("账户被锁，请联系管理员！！");
                    break;
                }
                System.out.println("账号密码有误，还剩" + count + "次机会！！");
            }
        }

    }
}
